﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class Ticksys_Inicio : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DataSet ds = CargarGridView.ConsultarTicketsUsuario(Page.User.Identity.Name);

            gv_Creados.DataSource = ds.Tables[0];
            gv_Creados.DataBind();

            DataSet ds_Sector = AccesoDatos.Consulta("SELECT idSector FROM Usuarios WHERE Username = '" + Page.User.Identity.Name + "'");

            DataSet ds1 = CargarGridView.ConsultarTicketsPendientes(ds_Sector.Tables[0].Rows[0]["idSector"].ToString());

            gv_Pendientes.DataSource = ds1.Tables[0];
            gv_Pendientes.DataBind();

            gv_Asignados.DataSource = CargarGridView.ConsultarTicketsAsignadosUsuario(Page.User.Identity.Name);
            gv_Asignados.DataBind();
        }
    }
    protected void btn_Editar_Click(object sender, ImageClickEventArgs e)
    {
        string id = (sender as ImageButton).CommandArgument;

        Response.Redirect("Ticket-Det.aspx?id=" + id);
    }
}